<?php
App::uses('AppModel', 'Model');
/**
 * Dissertation Model
 *
 * @property Dissertype $Dissertype
 * @property Recstatus $Recstatus
 */
class Dissertation extends AppModel {

/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'dissertype_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'message' => 'Выберите тип диссертации',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'chief_info' => array(
				'numeric' => array(
					'rule' => array('notEmpty'),
						'message' => 'Введите информацию о руководителях / консультантах (ФИО, степень, должность, огранизация)',
						//'allowEmpty' => false,
						//'required' => false,
						//'last' => false, // Stop validation after this rule
						//'on' => 'create', // Limit validation to 'create' or 'update' operations
				),
		),			
		'defdate' => array(
			'date' => array(
				'rule' => array('date'),
				'message' => 'Введите дату защиты',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'name' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'Введите название диссертации',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'place' => array(
				'notEmpty' => array(
						'rule' => array('notEmpty'),
						'message' => 'Введите город и полное название организации где проходила защита',
						//'allowEmpty' => false,
						//'required' => false,
						//'last' => false, // Stop validation after this rule
						//'on' => 'create', // Limit validation to 'create' or 'update' operations
				),
		),		
		'sovet_shifr' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'Введите шифр совета, пример: Д.208.039.01',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'profession_shifr' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'Введите шифр специальности, пример: 03.02.03',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'profession_name' => array(
			'notEmpty' => array(
				'rule' => array('notEmpty'),
				'message' => 'Введите название специальности',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'recstatus_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
	public $belongsTo = array(
		'Dissertype' => array(
			'className' => 'Dissertype',
			'foreignKey' => 'dissertype_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Recstatus' => array(
			'className' => 'Recstatus',
			'foreignKey' => 'recstatus_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
}
